package com.chao.product.message;

import com.chao.model.PmsProduct;
import com.rabbitmq.client.Channel;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

@Component
@RabbitListener(queues = "work_queue")
public class WorkMsg2 {

    @RabbitHandler
    public void workGetMsg(PmsProduct pmsProduct, Message message, Channel channel){
        System.out.println(message.getMessageProperties().getReceivedRoutingKey());
        System.out.println("consumer-2:"+pmsProduct);
    }
}